using System;
using System.Data;
using System.Collections.Generic;
using System.Collections;
using log4net;
using FSS.BLL.Entities;
namespace FSS.BLL.Services
{
	#region PermissionService

	/// <summary>
	/// PermissionService object for Ibatis mapped table 'Permission'.
	/// </summary>
	public class PermissionService : IPermissionService
	{
		private static readonly ILog log = LogManager.GetLogger(typeof(PermissionService).Name);
	  	private static volatile PermissionService _PermissionService = null;
        public static PermissionService GetInstance()
        {
            if (_PermissionService == null)
            {
                lock (typeof(PermissionService))
                {
                    if (_PermissionService == null) // double-check
                        _PermissionService = new PermissionService();
                }
            }
            return _PermissionService;
        }
		public PermissionService()
        {
            //
            // TODO: Add constructor logic here
            //
        }
        public PermissionEntity LoadByRoleAndScreen(PermissionEntity objE)
        {
            try
            {
                return ExecuteQueryForObject<PermissionEntity>("PermissionLoadByRoleAndScreen", objE);
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                return null;
            }
        }
        public IList<PermissionEntity> LoadByRole(PermissionEntity objE)
        {
            try
            {
                return ExecuteQueryForList<PermissionEntity>("PermissionLoadByRole", objE);
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                return null;
            }
        }
	}
	#endregion  
}
